<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The FilesystemIterator class</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="emptyiterator.valid.html">EmptyIterator::valid</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="filesystemiterator.construct.html">FilesystemIterator::__construct</a></div>
 <div class="up"><a href="spl.iterators.html">迭代器</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="class.filesystemiterator" class="reference">

 <h1 class="title">The FilesystemIterator class</h1>
 

 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.3.0)</p>


  <div class="section" id="filesystemiterator.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    The Filesystem iterator
   </p>
  </div>


  <div class="section" id="filesystemiterator.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <strong class="classname">FilesystemIterator</strong>
     </span>
     
     <span class="ooclass">
      <span class="modifier">extends</span>
      <a href="class.directoryiterator.html" class="classname">DirectoryIterator</a>
     </span>
     
     <span class="oointerface">implements 
      <span class="interfacename"><a href="class.seekableiterator.html" class="interfacename">SeekableIterator</a></span>
     </span>

     {</div>


   <div class="classsynopsisinfo classsynopsisinfo_comment">/* 常量 */</div>
    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.filesystemiterator.html#filesystemiterator.constants.current-as-pathname"><var class="varname">CURRENT_AS_PATHNAME</var></a></var>
     <span class="initializer"> = 32</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.filesystemiterator.html#filesystemiterator.constants.current-as-fileinfo"><var class="varname">CURRENT_AS_FILEINFO</var></a></var>
     <span class="initializer"> = 0</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.filesystemiterator.html#filesystemiterator.constants.current-as-self"><var class="varname">CURRENT_AS_SELF</var></a></var>
     <span class="initializer"> = 16</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.filesystemiterator.html#filesystemiterator.constants.current-mode-mask"><var class="varname">CURRENT_MODE_MASK</var></a></var>
     <span class="initializer"> = 240</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.filesystemiterator.html#filesystemiterator.constants.key-as-pathname"><var class="varname">KEY_AS_PATHNAME</var></a></var>
     <span class="initializer"> = 0</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.filesystemiterator.html#filesystemiterator.constants.key-as-filename"><var class="varname">KEY_AS_FILENAME</var></a></var>
     <span class="initializer"> = 256</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.filesystemiterator.html#filesystemiterator.constants.follow-symlinks"><var class="varname">FOLLOW_SYMLINKS</var></a></var>
     <span class="initializer"> = 512</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.filesystemiterator.html#filesystemiterator.constants.key-mode-mask"><var class="varname">KEY_MODE_MASK</var></a></var>
     <span class="initializer"> = 3840</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.filesystemiterator.html#filesystemiterator.constants.new-current-and-key"><var class="varname">NEW_CURRENT_AND_KEY</var></a></var>
     <span class="initializer"> = 256</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.filesystemiterator.html#filesystemiterator.constants.skip-dots"><var class="varname">SKIP_DOTS</var></a></var>
     <span class="initializer"> = 4096</span>
    ;</div>

    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">integer</span>
      <var class="fieldsynopsis_varname"><a href="class.filesystemiterator.html#filesystemiterator.constants.unix-paths"><var class="varname">UNIX_PATHS</var></a></var>
     <span class="initializer"> = 8192</span>
    ;</div>

    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="filesystemiterator.construct.html" class="methodname">__construct</a></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$path</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code><span class="initializer"> = FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::SKIP_DOTS</span></span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">mixed</span><span class="methodname"><a href="filesystemiterator.current.html" class="methodname">current</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="filesystemiterator.getflags.html" class="methodname">getFlags</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="filesystemiterator.key.html" class="methodname">key</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="filesystemiterator.next.html" class="methodname">next</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="filesystemiterator.rewind.html" class="methodname">rewind</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="filesystemiterator.setflags.html" class="methodname">setFlags</a></span>
    ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$flags</code></span>
  ] )</div>

    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 继承的方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">DirectoryIterator</span><span class="methodname"><a href="directoryiterator.current.html" class="methodname">DirectoryIterator::current</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="directoryiterator.getatime.html" class="methodname">DirectoryIterator::getATime</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">string</span>
   <span class="methodname"><a href="directoryiterator.getbasename.html" class="methodname">DirectoryIterator::getBasename</a></span>
    ([ <span class="methodparam">
    <span class="type">string</span>
     <code class="parameter">$suffix</code>
   </span>
  ] )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="directoryiterator.getctime.html" class="methodname">DirectoryIterator::getCTime</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="directoryiterator.getextension.html" class="methodname">DirectoryIterator::getExtension</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="directoryiterator.getfilename.html" class="methodname">DirectoryIterator::getFilename</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="directoryiterator.getgroup.html" class="methodname">DirectoryIterator::getGroup</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="directoryiterator.getinode.html" class="methodname">DirectoryIterator::getInode</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="directoryiterator.getmtime.html" class="methodname">DirectoryIterator::getMTime</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="directoryiterator.getowner.html" class="methodname">DirectoryIterator::getOwner</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="directoryiterator.getpath.html" class="methodname">DirectoryIterator::getPath</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="directoryiterator.getpathname.html" class="methodname">DirectoryIterator::getPathname</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="directoryiterator.getperms.html" class="methodname">DirectoryIterator::getPerms</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span><span class="methodname"><a href="directoryiterator.getsize.html" class="methodname">DirectoryIterator::getSize</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span><span class="methodname"><a href="directoryiterator.gettype.html" class="methodname">DirectoryIterator::getType</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="directoryiterator.isdir.html" class="methodname">DirectoryIterator::isDir</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="directoryiterator.isdot.html" class="methodname">DirectoryIterator::isDot</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="directoryiterator.isexecutable.html" class="methodname">DirectoryIterator::isExecutable</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="directoryiterator.isfile.html" class="methodname">DirectoryIterator::isFile</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="directoryiterator.islink.html" class="methodname">DirectoryIterator::isLink</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="directoryiterator.isreadable.html" class="methodname">DirectoryIterator::isReadable</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="directoryiterator.iswritable.html" class="methodname">DirectoryIterator::isWritable</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="directoryiterator.key.html" class="methodname">DirectoryIterator::key</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="directoryiterator.next.html" class="methodname">DirectoryIterator::next</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">void</span><span class="methodname"><a href="directoryiterator.rewind.html" class="methodname">DirectoryIterator::rewind</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">void</span>
   <span class="methodname"><a href="directoryiterator.seek.html" class="methodname">DirectoryIterator::seek</a></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$position</code></span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span>
   <span class="type">string</span>
   <span class="methodname"><a href="directoryiterator.tostring.html" class="methodname">DirectoryIterator::__toString</a></span>
    ( <span class="methodparam">void</span>
   )</div>
<div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">bool</span><span class="methodname"><a href="directoryiterator.valid.html" class="methodname">DirectoryIterator::valid</a></span>
    ( <span class="methodparam">void</span>
   )</div>


   }</div>


  </div>
 
  
  <div class="section" id="filesystemiterator.constants">
   <h2 class="title">预定义常量</h2>
   <dl>

    
     <dt id="filesystemiterator.constants.current-as-pathname"><strong><code>FilesystemIterator::CURRENT_AS_PATHNAME</code></strong></dt>

     <dd>

      <p class="para">Makes <span class="methodname"><a href="filesystemiterator.current.html" class="methodname">FilesystemIterator::current()</a></span> return the pathname.</p>
     </dd>

    
    
     <dt id="filesystemiterator.constants.current-as-fileinfo"><strong><code>FilesystemIterator::CURRENT_AS_FILEINFO</code></strong></dt>

     <dd>

      <p class="para">Makes <span class="methodname"><a href="filesystemiterator.current.html" class="methodname">FilesystemIterator::current()</a></span> return an <a href="class.splfileinfo.html" class="classname">SplFileInfo</a> instance.</p>
     </dd>

    
    
     <dt id="filesystemiterator.constants.current-as-self"><strong><code>FilesystemIterator::CURRENT_AS_SELF</code></strong></dt>

     <dd>

      <p class="para">Makes <span class="methodname"><a href="filesystemiterator.current.html" class="methodname">FilesystemIterator::current()</a></span> return $this (the FilesystemIterator).</p>
     </dd>

    
    
     <dt id="filesystemiterator.constants.current-mode-mask"><strong><code>FilesystemIterator::CURRENT_MODE_MASK</code></strong></dt>

     <dd>

      <p class="para">Masks <span class="methodname"><a href="filesystemiterator.current.html" class="methodname">FilesystemIterator::current()</a></span></p>
     </dd>

    
    
     <dt id="filesystemiterator.constants.key-as-pathname"><strong><code>FilesystemIterator::KEY_AS_PATHNAME</code></strong></dt>

     <dd>

      <p class="para">Makes <span class="methodname"><a href="filesystemiterator.key.html" class="methodname">FilesystemIterator::key()</a></span> return the pathname.</p>
     </dd>

    
    
     <dt id="filesystemiterator.constants.key-as-filename"><strong><code>FilesystemIterator::KEY_AS_FILENAME</code></strong></dt>

     <dd>

      <p class="para">Makes <span class="methodname"><a href="filesystemiterator.key.html" class="methodname">FilesystemIterator::key()</a></span> return the filename.</p>
     </dd>

    
    
     <dt id="filesystemiterator.constants.follow-symlinks"><strong><code>FilesystemIterator::FOLLOW_SYMLINKS</code></strong></dt>

     <dd>

      <p class="para">Makes <span class="methodname"><a href="recursivedirectoryiterator.haschildren.html" class="methodname">RecursiveDirectoryIterator::hasChildren()</a></span> follow symlinks.</p>
     </dd>

    
    
     <dt id="filesystemiterator.constants.key-mode-mask"><strong><code>FilesystemIterator::KEY_MODE_MASK</code></strong></dt>

     <dd>

      <p class="para">Masks <span class="methodname"><a href="filesystemiterator.key.html" class="methodname">FilesystemIterator::key()</a></span></p>
     </dd>

    
    
     <dt id="filesystemiterator.constants.new-current-and-key"><strong><code>FilesystemIterator::NEW_CURRENT_AND_KEY</code></strong></dt>

     <dd>

      <p class="para">Same as <em>FilesystemIterator::KEY_AS_FILENAME | FilesystemIterator::CURRENT_AS_FILEINFO</em>.</p>
     </dd>

    
    
     <dt id="filesystemiterator.constants.skip-dots"><strong><code>FilesystemIterator::SKIP_DOTS</code></strong></dt>

     <dd>

      <p class="para">Skips dot files (<em>.</em> and <em>..</em>).</p>
     </dd>

    
    
     <dt id="filesystemiterator.constants.unix-paths"><strong><code>FilesystemIterator::UNIX_PATHS</code></strong></dt>

     <dd>

      <p class="para">Makes paths use Unix-style forward slash irrespective of system default.</p>
     </dd>

    
   </dl>

  </div>
  

  
  <div class="section">
   <h2 class="title">更新日志</h2>
   <p class="para">
    <table class="doctable informaltable">
     
      <thead>
       <tr>
        <th>版本</th>
        <th>说明</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td>5.3.1</td>
        <td>Added <strong><code>FilesystemIterator::FOLLOW_SYMLINKS</code></strong></td>
       </tr>

      </tbody>
     
    </table>

   </p>
  </div>
    

 </div>

 


















































<h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="filesystemiterator.construct.html">FilesystemIterator::__construct</a> — Constructs a new filesystem iterator</li><li><a href="filesystemiterator.current.html">FilesystemIterator::current</a> — The current file</li><li><a href="filesystemiterator.getflags.html">FilesystemIterator::getFlags</a> — Get the handling flags</li><li><a href="filesystemiterator.key.html">FilesystemIterator::key</a> — Retrieve the key for the current file</li><li><a href="filesystemiterator.next.html">FilesystemIterator::next</a> — Move to the next file</li><li><a href="filesystemiterator.rewind.html">FilesystemIterator::rewind</a> — Rewinds back to the beginning</li><li><a href="filesystemiterator.setflags.html">FilesystemIterator::setFlags</a> — Sets handling flags</li></ul>
</div>
<hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="emptyiterator.valid.html">EmptyIterator::valid</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="filesystemiterator.construct.html">FilesystemIterator::__construct</a></div>
 <div class="up"><a href="spl.iterators.html">迭代器</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
